<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RocketMQ消息持久化机制深度解析</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8fafc;
            color: #1e293b;
            line-height: 1.6;
        }
        .gradient-bg {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
        }
        .code-block {
            background-color: #1e293b;
            color: #e2e8f0;
            border-radius: 0.5rem;
            padding: 1.5rem;
            font-family: 'Courier New', Courier, monospace;
            position: relative;
        }
        .code-block:before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 4px;
            height: 100%;
            background: linear-gradient(to bottom, #8b5cf6, #ec4899);
            border-radius: 0.5rem 0 0 0.5rem;
        }
        .feature-card {
            transition: all 0.3s ease;
            border-left: 4px solid transparent;
        }
        .feature-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
            border-left-color: #4f46e5;
        }
        .section-divider {
            height: 1px;
            background: linear-gradient(to right, transparent, #cbd5e1, transparent);
            margin: 4rem 0;
        }
        .visualization {
            background-color: white;
            border-radius: 0.75rem;
            padding: 2rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        .performance-table {
            width: 100%;
            border-collapse: collapse;
        }
        .performance-table th, .performance-table td {
            padding: 1rem;
            text-align: center;
            border: 1px solid #e2e8f0;
        }
        .performance-table th {
            background-color: #4f46e5;
            color: white;
            font-weight: 500;
        }
        .performance-table tr:nth-child(even) {
            background-color: #f8fafc;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="gradient-bg text-white py-20 px-4 sm:px-6 lg:px-8">
        <div class="max-w-4xl mx-auto text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6">RocketMQ消息持久化机制</h1>
            <p class="text-xl md:text-2xl font-light mb-8 leading-relaxed">深入解析高可靠消息中间件的核心存储架构与优化实践</p>
            <div class="flex justify-center space-x-4">
                <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm font-medium"><i class="fas fa-database mr-2"></i>高可靠存储</span>
                <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm font-medium"><i class="fas fa-tachometer-alt mr-2"></i>高性能设计</span>
                <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm font-medium"><i class="fas fa-cogs mr-2"></i>优化实践</span>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <!-- Introduction -->
        <div class="mb-16">
            <div class="relative">
                <div class="absolute -left-8 top-0 h-full w-1 bg-gradient-to-b from-indigo-500 to-purple-600 rounded-full"></div>
                <p class="text-lg text-slate-700 pl-6 leading-relaxed">
                    RocketMQ的消息持久化是保证消息可靠性的核心机制，它通过将消息存储到物理磁盘，确保在Broker宕机或重启后，消息不会丢失。RocketMQ采用了独特的存储架构来实现高效的消息持久化，本文将深入解析其实现原理、配置参数、性能影响及最佳实践。
                </p>
            </div>
        </div>

        <!-- Storage Architecture -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-slate-800 flex items-center">
                <span class="w-8 h-8 rounded-full bg-indigo-600 text-white flex items-center justify-center mr-4">1</span>
                存储架构概述
            </h2>
            
            <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
                <div class="feature-card bg-white p-6 rounded-lg shadow-sm">
                    <div class="text-indigo-600 text-2xl mb-4"><i class="fas fa-file-alt"></i></div>
                    <h3 class="text-xl font-semibold mb-3">CommitLog</h3>
                    <p class="text-slate-600">RocketMQ最核心的存储文件，所有消息按照写入顺序存储，不做任何主题或队列的区分。</p>
                    <ul class="mt-4 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>顺序写入，提高写入效率</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>消息按照时间顺序存储</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>单个文件默认1GB</span>
                        </li>
                    </ul>
                </div>
                
                <div class="feature-card bg-white p-6 rounded-lg shadow-sm">
                    <div class="text-indigo-600 text-2xl mb-4"><i class="fas fa-search"></i></div>
                    <h3 class="text-xl font-semibold mb-3">ConsumeQueue</h3>
                    <p class="text-slate-600">CommitLog的索引文件，按照主题和队列组织，提供消息的快速检索。</p>
                    <ul class="mt-4 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>每个主题/队列对应一个文件</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>每个条目固定大小(20字节)</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>默认包含30万个条目</span>
                        </li>
                    </ul>
                </div>
                
                <div class="feature-card bg-white p-6 rounded-lg shadow-sm">
                    <div class="text-indigo-600 text-2xl mb-4"><i class="fas fa-key"></i></div>
                    <h3 class="text-xl font-semibold mb-3">IndexFile</h3>
                    <p class="text-slate-600">提供了根据消息Key查询消息的能力，是一种哈希索引实现。</p>
                    <ul class="mt-4 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>可选组件，默认开启</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>单个文件默认400MB</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>支持Key和时间区间查询</span>
                        </li>
                    </ul>
                </div>
            </div>

            <!-- Visualization -->
            <div class="visualization mb-12">
                <h3 class="text-xl font-semibold mb-6 text-center">RocketMQ存储架构可视化</h3>
                <div class="mermaid">
                    graph TD
                        A[Producer] -->|发送消息| B[Broker]
                        B --> C[CommitLog]
                        C --> D[ConsumeQueue]
                        C --> E[IndexFile]
                        D --> F[Consumer]
                        E --> F
                </div>
            </div>
        </section>

        <div class="section-divider"></div>

        <!-- Message Flow -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-slate-800 flex items-center">
                <span class="w-8 h-8 rounded-full bg-indigo-600 text-white flex items-center justify-center mr-4">2</span>
                消息读写流程
            </h2>
            
            <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                <div>
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-paper-plane mr-3"></i>消息写入流程
                    </h3>
                    <div class="bg-white p-6 rounded-lg shadow-sm">
                        <ol class="space-y-4">
                            <li class="flex items-start">
                                <span class="flex items-center justify-center w-6 h-6 rounded-full bg-indigo-100 text-indigo-800 font-bold mr-3 flex-shrink-0">1</span>
                                <span>Producer发送消息到Broker</span>
                            </li>
                            <li class="flex items-start">
                                <span class="flex items-center justify-center w-6 h-6 rounded-full bg-indigo-100 text-indigo-800 font-bold mr-3 flex-shrink-0">2</span>
                                <span>Broker接收消息后，首先将消息写入CommitLog</span>
                            </li>
                            <li class="flex items-start">
                                <span class="flex items-center justify-center w-6 h-6 rounded-full bg-indigo-100 text-indigo-800 font-bold mr-3 flex-shrink-0">3</span>
                                <div>
                                    <span>建立ConsumeQueue索引：</span>
                                    <ul class="mt-2 pl-4 space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-angle-right text-indigo-500 mt-1 mr-2"></i>
                                            <span>消息写入CommitLog成功后，异步构建ConsumeQueue索引</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-angle-right text-indigo-500 mt-1 mr-2"></i>
                                            <span>将消息在CommitLog中的偏移量、大小和Tag哈希值写入对应的ConsumeQueue文件</span>
                                        </li>
                                    </ul>
                                </div>
                            </li>
                            <li class="flex items-start">
                                <span class="flex items-center justify-center w-6 h-6 rounded-full bg-indigo-100 text-indigo-800 font-bold mr-3 flex-shrink-0">4</span>
                                <span>建立IndexFile索引（如果消息包含Key）</span>
                            </li>
                        </ol>
                    </div>
                </div>
                
                <div>
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-search mr-3"></i>消息读取流程
                    </h3>
                    <div class="bg-white p-6 rounded-lg shadow-sm">
                        <ol class="space-y-4">
                            <li class="flex items-start">
                                <span class="flex items-center justify-center w-6 h-6 rounded-full bg-indigo-100 text-indigo-800 font-bold mr-3 flex-shrink-0">1</span>
                                <span>Consumer向Broker请求消费消息</span>
                            </li>
                            <li class="flex items-start">
                                <span class="flex items-center justify-center w-6 h-6 rounded-full bg-indigo-100 text-indigo-800 font-bold mr-3 flex-shrink-0">2</span>
                                <span>Broker根据消费位点从ConsumeQueue中查找消息索引</span>
                            </li>
                            <li class="flex items-start">
                                <span class="flex items-center justify-center w-6 h-6 rounded-full bg-indigo-100 text-indigo-800 font-bold mr-3 flex-shrink-0">3</span>
                                <span>根据索引中的物理偏移量从CommitLog中读取消息内容</span>
                            </li>
                            <li class="flex items-start">
                                <span class="flex items-center justify-center w-6 h-6 rounded-full bg-indigo-100 text-indigo-800 font-bold mr-3 flex-shrink-0">4</span>
                                <span>返回消息给Consumer</span>
                            </li>
                        </ol>
                    </div>
                </div>
            </div>
        </section>

        <div class="section-divider"></div>

        <!-- Flush Mechanism -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-slate-800 flex items-center">
                <span class="w-8 h-8 rounded-full bg-indigo-600 text-white flex items-center justify-center mr-4">3</span>
                刷盘机制
            </h2>
            
            <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                <div class="bg-white p-6 rounded-lg shadow-sm border-t-4 border-indigo-500">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">同步刷盘</h3>
                    <p class="text-slate-600 mb-4">消息写入内存后，立即将数据刷写到磁盘，然后返回写入成功的响应。</p>
                    <div class="flex items-center mb-2">
                        <i class="fas fa-shield-alt text-green-500 mr-2"></i>
                        <span class="font-medium">可靠性高</span>
                    </div>
                    <div class="flex items-center mb-2">
                        <i class="fas fa-tachometer-alt text-yellow-500 mr-2"></i>
                        <span class="font-medium">性能相对较低</span>
                    </div>
                    <div class="flex items-center">
                        <i class="fas fa-exchange-alt text-purple-500 mr-2"></i>
                        <span class="font-medium">适用于对数据可靠性要求高的场景</span>
                    </div>
                </div>
                
                <div class="bg-white p-6 rounded-lg shadow-sm border-t-4 border-blue-500">
                    <h3 class="text-xl font-semibold mb-4 text-blue-600">异步刷盘</h3>
                    <p class="text-slate-600 mb-4">消息写入内存后，立即返回写入成功的响应，然后异步将数据刷写到磁盘。</p>
                    <div class="flex items-center mb-2">
                        <i class="fas fa-bolt text-green-500 mr-2"></i>
                        <span class="font-medium">性能高</span>
                    </div>
                    <div class="flex items-center mb-2">
                        <i class="fas fa-exclamation-triangle text-yellow-500 mr-2"></i>
                        <span class="font-medium">可靠性相对较低</span>
                    </div>
                    <div class="flex items-center">
                        <i class="fas fa-exchange-alt text-purple-500 mr-2"></i>
                        <span class="font-medium">适用于对性能要求高的场景</span>
                    </div>
                </div>
            </div>
        </section>

        <div class="section-divider"></div>

        <!-- Configuration -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-slate-800 flex items-center">
                <span class="w-8 h-8 rounded-full bg-indigo-600 text-white flex items-center justify-center mr-4">4</span>
                持久化相关配置参数
            </h2>
            
            <div class="mb-8">
                <h3 class="text-xl font-semibold mb-4 text-slate-700">存储路径配置</h3>
                <div class="code-block">
                    <pre># 存储根目录
storePathRootDir=$HOME/store

# CommitLog存储路径
storePathCommitLog=$HOME/store/commitlog

# ConsumeQueue存储路径
storePathConsumeQueue=$HOME/store/consumequeue

# IndexFile存储路径
storePathIndex=$HOME/store/index</pre>
                </div>
            </div>
            
            <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                <div>
                    <h3 class="text-xl font-semibold mb-4 text-slate-700">文件大小配置</h3>
                    <div class="code-block">
                        <pre># CommitLog单个文件大小，默认1GB
mapedFileSizeCommitLog=1073741824

# ConsumeQueue单个文件大小
mapedFileSizeConsumeQueue=6000000

# IndexFile单个文件大小，默认400MB
indexFileMaxHashSlotNum=5000000</pre>
                    </div>
                </div>
                
                <div>
                    <h3 class="text-xl font-semibold mb-4 text-slate-700">刷盘策略配置</h3>
                    <div class="code-block">
                        <pre># 刷盘策略，SYNC_FLUSH或ASYNC_FLUSH
flushDiskType=ASYNC_FLUSH

# 异步刷盘时间间隔，单位毫秒
flushIntervalCommitLog=500

# 异步刷盘条数阈值
flushCommitLogThoroughInterval=10000

# ConsumeQueue刷盘间隔
flushIntervalConsumeQueue=1000</pre>
                    </div>
                </div>
            </div>
        </section>

        <div class="section-divider"></div>

        <!-- Performance -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-slate-800 flex items-center">
                <span class="w-8 h-8 rounded-full bg-indigo-600 text-white flex items-center justify-center mr-4">5</span>
                持久化对性能的影响及优化方法
            </h2>
            
            <div class="bg-white p-6 rounded-lg shadow-sm mb-8">
                <h3 class="text-xl font-semibold mb-4 text-slate-700">持久化对性能的影响</h3>
                <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                    <div class="p-4 border border-slate-200 rounded-lg">
                        <div class="flex items-center mb-2">
                            <i class="fas fa-hdd text-red-500 mr-2"></i>
                            <span class="font-medium">磁盘IO影响</span>
                        </div>
                        <ul class="text-sm text-slate-600 pl-6 space-y-1">
                            <li>• 写入延迟：受限于磁盘IO性能</li>
                            <li>• 读取延迟：增加消息消费延迟</li>
                            <li>• 吞吐量限制：受磁盘IO带宽限制</li>
                        </ul>
                    </div>
                    <div class="p-4 border border-slate-200 rounded-lg">
                        <div class="flex items-center mb-2">
                            <i class="fas fa-memory text-blue-500 mr-2"></i>
                            <span class="font-medium">内存占用</span>
                        </div>
                        <ul class="text-sm text-slate-600 pl-6 space-y-1">
                            <li>• 大量使用操作系统页缓存</li>
                            <li>• 内存映射文件技术占用内存</li>
                        </ul>
                    </div>
                    <div class="p-4 border border-slate-200 rounded-lg">
                        <div class="flex items-center mb-2">
                            <i class="fas fa-sync text-purple-500 mr-2"></i>
                            <span class="font-medium">刷盘策略影响</span>
                        </div>
                        <ul class="text-sm text-slate-600 pl-6 space-y-1">
                            <li>• 同步刷盘：性能低但可靠性高</li>
                            <li>• 异步刷盘：性能高但可靠性低</li>
                        </ul>
                    </div>
                </div>
            </div>
            
            <div class="bg-white p-6 rounded-lg shadow-sm mb-8">
                <h3 class="text-xl font-semibold mb-4 text-slate-700">性能优化方法</h3>
                <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                    <div>
                        <h4 class="font-semibold mb-2 text-indigo-600">硬件优化</h4>
                        <ul class="text-sm text-slate-600 pl-5 space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>使用SSD提高IOPS</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>使用RAID10配置</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>增加内存容量</span>
                            </li>
                        </ul>
                    </div>
                    <div>
                        <h4 class="font-semibold mb-2 text-indigo-600">参数优化</h4>
                        <ul class="text-sm text-slate-600 pl-5 space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>调整刷盘策略</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>优化刷盘间隔</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>调整文件大小</span>
                            </li>
                        </ul>
                    </div>
                    <div>
                        <h4 class="font-semibold mb-2 text-indigo-600">架构优化</h4>
                        <ul class="text-sm text-slate-600 pl-5 space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>使用主从架构</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>消息批量发送</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>合理设置主题和队列数</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            
            <div class="bg-white p-6 rounded-lg shadow-sm">
                <h3 class="text-xl font-semibold mb-4 text-slate-700">性能测试数据</h3>
                <p class="text-slate-600 mb-4 text-sm">以下为不同配置下的性能测试数据（仅供参考，实际性能取决于硬件配置和业务场景）：</p>
                <div class="overflow-x-auto">
                    <table class="performance-table">
                        <thead>
                            <tr>
                                <th>配置</th>
                                <th>发送TPS</th>
                                <th>消费TPS</th>
                                <th>平均延迟</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>异步刷盘 + 异步复制</td>
                                <td>10万+</td>
                                <td>10万+</td>
                                <td>毫秒级</td>
                            </tr>
                            <tr>
                                <td>同步刷盘 + 异步复制</td>
                                <td>3万+</td>
                                <td>10万+</td>
                                <td>10毫秒级</td>
                            </tr>
                            <tr>
                                <td>异步刷盘 + 同步复制</td>
                                <td>5万+</td>
                                <td>10万+</td>
                                <td>毫秒级</td>
                            </tr>
                            <tr>
                                <td>同步刷盘 + 同步复制</td>
                                <td>1万+</td>
                                <td>10万+</td>
                                <td>10毫秒级</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </section>

        <div class="section-divider"></div>

        <!-- Best Practices -->
        <section>
            <h2 class="text-3xl font-bold mb-8 text-slate-800 flex items-center">
                <span class="w-8 h-8 rounded-full bg-indigo-600 text-white flex items-center justify-center mr-4">6</span>
                最佳实践
            </h2>
            
            <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
                <div class="bg-white p-6 rounded-lg shadow-sm">
                    <h3 class="text-xl font-semibold mb-4 text-slate-700">生产环境配置建议</h3>
                    <div class="space-y-4">
                        <div class="p-4 bg-indigo-50 rounded-lg">
                            <h4 class="font-semibold text-indigo-700 mb-2">高可靠性场景</h4>
                            <ul class="text-sm text-slate-700 pl-5 space-y-1">
                                <li>• 同步刷盘 + 同步复制</li>
                                <li>• 适用于金融、支付等场景</li>
                            </ul>
                        </div>
                        <div class="p-4 bg-blue-50 rounded-lg">
                            <h4 class="font-semibold text-blue-700 mb-2">高性能场景</h4>
                            <ul class="text-sm text-slate-700 pl-5 space-y-1">
                                <li>• 异步刷盘 + 异步复制</li>
                                <li>• 适用于日志收集、监控数据等</li>
                            </ul>
                        </div>
                        <div class="p-4 bg-purple-50 rounded-lg">
                            <h4 class="font-semibold text-purple-700 mb-2">平衡场景</h4>
                            <ul class="text-sm text-slate-700 pl-5 space-y-1">
                                <li>• 异步刷盘 + 同步复制</li>
                                <li>• 在主从节点间保证数据一致性</li>
                            </ul>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white p-6 rounded-lg shadow-sm">
                    <h3 class="text-xl font-semibold mb-4 text-slate-700">磁盘空间规划</h3>
                    <div class="space-y-4">
                        <div>
                            <h4 class="font-semibold text-slate-700 mb-2">容量估算</h4>
                            <div class="code-block">
                                <pre>日消息量 × 平均消息大小 × 保留天数 × 1.5（冗余系数）</pre>
                            </div>
                        </div>
                        <div>
                            <h4 class="font-semibold text-slate-700 mb-2">监控策略</h4>
                            <ul class="text-sm text-slate-700 pl-5 space-y-1">
                                <li>• 设置磁盘使用率告警（建议阈值75%）</li>
                                <li>• 定期清理过期消息文件</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="bg-white p-6 rounded-lg shadow-sm">
                <h3 class="text-xl font-semibold mb-4 text-slate-700">监控指标</h3>
                <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                    <div>
                        <h4 class="font-semibold mb-2 text-indigo-600">磁盘IO</h4>
                        <ul class="text-sm text-slate-600 pl-5 space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-chart-line text-blue-500 mt-1 mr-2"></i>
                                <span>监控磁盘读写速率和IOPS</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-chart-pie text-purple-500 mt-1 mr-2"></i>
                                <span>监控磁盘使用率</span>
                            </li>
                        </ul>
                    </div>
                    <div>
                        <h4 class="font-semibold mb-2 text-indigo-600">消息积压</h4>
                        <ul class="text-sm text-slate-600 pl-5 space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-exclamation-triangle text-yellow-500 mt-1 mr-2"></i>
                                <span>监控各个主题的消息积压情况</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-bell text-red-500 mt-1 mr-2"></i>
                                <span>设置积压告警阈值</span>
                            </li>
                        </ul>
                    </div>
                    <div>
                        <h4 class="font-semibold mb-2 text-indigo-600">刷盘延迟</h4>
                        <ul class="text-sm text-slate-600 pl-5 space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-clock text-orange-500 mt-1 mr-2"></i>
                                <span>监控异步刷盘的延迟时间</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-times-circle text-red-500 mt-1 mr-2"></i>
                                <span>监控刷盘失败次数</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 添加微交互效果
        document.addEventListener('DOMContentLoaded', function() {
            // 卡片悬停效果
            const cards = document.querySelectorAll('.feature-card');
            cards.forEach(card => {
                card.addEventListener('mouseenter', function() {
                    this.style.boxShadow = '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)';
                });
                card.addEventListener('mouseleave', function() {
                    this.style.boxShadow = '';
                });
            });
            
            // 平滑滚动
            document.querySelectorAll('a[href^="#"]').forEach(anchor => {
                anchor.addEventListener('click', function(e) {
                    e.preventDefault();
                    document.querySelector(this.getAttribute('href')).scrollIntoView({
                        behavior: 'smooth'
                    });
                });
            });
        });
    </script>
</body>
</html>